package com.own.business.message.center.mapper;

import com.own.business.message.center.entity.map.MessageCenterContentMapVo;
import com.own.business.message.center.entity.po.MessageCenterContent;
import com.own.business.message.center.entity.query.MessageCenterContentQuery;
import com.own.business.message.center.entity.vo.MessageCenterContentVo;
import com.own.component.common.base.mapper.BasePageMapper;
import com.own.component.common.model.ItemCountModel;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * MessageCenterContentMapper
 *
 * @author chenxueli
 * @date 2023-11-13 14:39:27
 */
@Mapper
public interface MessageCenterContentMapper extends BasePageMapper<
        MessageCenterContent,
        MessageCenterContentVo,
        MessageCenterContentMapVo,
        MessageCenterContentQuery
        > {

    /**
     * 根据用户id分组查询未读数量（messageKey）
     *
     * @param userId 用户id
     * @return 未读数量
     */
    List<ItemCountModel> mapCountUnreadByUserIdForMessageKey(Long userId);

    /**
     * 根据用户id分组查询最新的消息（messageKey）
     *
     * @param userId 用户id
     * @return 最新的消息
     */
    List<MessageCenterContent> mapLatestMessageByUserIdForMessageKey(Long userId);

}
